#coding=utf-8
"""musicpro URL Configuration


The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin

from django.conf.urls import include, url,static
from django.contrib import admin
from musicpro.activator import process
from musicpro.settings import MEDIA_ROOT
from django.views.static import serve
from rest_framework import routers
from rest_framework.documentation import include_docs_urls
from datareport.views import *
from wechat.views import *
router = routers.DefaultRouter()
router.register(r'VodErrorLog',VodErrorLogViewSet,base_name="VodErrorLogViewSet")
router.register(r'MachineActiveStatus',MachineActiveStatusViewSet,base_name="machineActiveStatusViewSet")
router.register(r'test',TestViewSet,base_name="test")
router.register(r'product_order',ProductOrderViewSet,base_name="product_order")
router.register(r'storereport',StoreReportViewSet,base_name="storereport")
router.register(r'marchantlogin',MachantLoginViewSet,base_name="marchantlogin")
router.register(r'storeinfo',storeinfoViewSet,base_name="storeinfo")
router.register(r'machineinfo',machineinfoViewSet,base_name="machineinfo")
router.register(r'merchantinfo',merchantinfoViewSet,base_name="merchantinfo")
router.register(r'UserInfo',UserinfoViewSet,base_name="UserinfoViewSet")
router.register(r'userconsume',userconsumeViewSet,base_name="userconsumeViewSet")
router.register(r'userrecharge',userrechargeViewSet,base_name="userrechargeViewSet")
router.register(r'RecordFile',RecordFileViewSet,base_name="RecordFileViewSet")
router.register(r'machinedetailconsume',machinedetailconsumeViewSet,base_name="machinedetailconsume")
urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'docs/', include_docs_urls(title="乐音坊接口文档")),
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
    url(r'^', include(router.urls)),
    url('^(?P<app>(\w+))/$',process,{'function':'index'}),
    url('^(?P<app>(\w+))/(?P<function>(\w+))/$',process),
    url(r'^media/(?P<path>.*)/$', serve, {"document_root": MEDIA_ROOT}),    
#       ('^(?P<app>(\w+))/(?P<function>(\w+))/ ')
]

from apscheduler.scheduler import  Scheduler
from tasks  import *
test1()
sched = Scheduler()
print type(sched)  
@sched.interval_schedule(seconds=1)
def my_task():
    test1()
#sched.start()
print 'what  goushi'
